#include "PreCompile.hpp"
#include "GCCOutputParserTests.hpp"
#include "TestProjects.hpp"
#include "MiscTests.hpp"
#include "LanguagesTests.hpp"

int main()
{
  try
  {
    BuildNG::init_shared();
    BuildNG::init_libbuildng("../../Win32Settings.xml");
    BuildNG::init_clang();
    
    BuildNG::GCCOutputParserTests::test_full_error_line();
    BuildNG::GCCOutputParserTests::test_full_warning_line();
    BuildNG::GCCOutputParserTests::test_empty_line();
    BuildNG::GCCOutputParserTests::test_non_error_line1();
    BuildNG::GCCOutputParserTests::test_non_error_line2();
    BuildNG::GCCOutputParserTests::test_no_column_specified();

    BuildNG::MiscTests::test_clang_source_file_type_by_ext();

    BuildNG::TestProjects::test_simple();
    BuildNG::TestProjects::test_ignore_header();
    BuildNG::TestProjects::test_pkg_reference();

    BuildNG::LanguagesTests language_tests;
    language_tests.test_cpp_keywords_in_c();
    language_tests.test_cpp_file_in_c_module();
    language_tests.test_c_file_in_cpp_module();

    BuildNG::shutdown_clang();
    BuildNG::shutdown_libbuildng();
    BuildNG::shutdown_shared();
  }
  catch(const std::exception &err)
  {
    std::cout << err.what() << std::endl;
    assert(!"Exception thrown");
  }
  catch(const Glib::Exception &err)
  {
    std::cout << err.what() << std::endl;
    assert(!"Exception thrown");
  }
  catch(...)
  {
    assert(!"Unknown err!");
  }

  return 0;
}

